#ifndef _LINUX_CRC_CCITT_H
#define _LINUX_CRC_CCITT_H

#include <stdint.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C"{
#endif

extern uint16_t const crc_ccitt_table[256];

extern uint16_t crc16_ccitt_k(uint16_t crc, const uint8_t *buffer, size_t len);

extern uint16_t crc16_ccitt(uint8_t const *buffer, size_t len);

static inline uint16_t crc_ccitt_byte(uint16_t crc, const uint8_t c)
{
	return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
}

#ifdef __cplusplus
}
#endif

#endif /* _LINUX_CRC_CCITT_H */
